var express = require('express');
var router = express.Router();
var connection = require('../db/sql.js')
/* GET home page. */
router.get('/', function(req, res, next) {
  res.render('index', { title: 'Express' });
});
//读取数据并存放在/words中
router.get("/words", function(req, res, next) {
    connection.query('SELECT * from court', function(error, results, fields) {
        if (error) throw error;
        console.log('The solution is: ', results);
        res.send(results)
    });

});

module.exports = router;
